/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package runattime;

import javax.swing.JOptionPane;

/**
 *
 * @author Kubik
 */
public class Shutdown extends java.util.TimerTask {
    public Shutdown(){
        
    }
    
    @Override
    public void run(){
        try{
            try{
                Casovac.quitProcess();
            }catch(Exception e){
                JOptionPane.showMessageDialog(null, "Chyba při Casovac.quitProcess() v Shutdown:run()");
            }
            java.io.FileWriter fw = new java.io.FileWriter("debug.txt");
            java.io.BufferedWriter bw = new java.io.BufferedWriter(fw);
            java.text.DateFormat dateFormat = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            java.util.Date date = new java.util.Date();
            bw.write("Asdfdsafsd\n");
            fw.write("fw.write\n");
            bw.write(dateFormat.format(date)+" Casovac.quitProcess()\n");
        }catch(Exception e){
            JOptionPane.showMessageDialog(null, "Nastala chyba při zápisu do souboru! "+e.getMessage());
        }
        this.cancel();
    }
}
